#include <tinx/syscall.h>
#include <tinx/stdio.h>

static char buf[1024];

int main(int argc, char *argv[])
{
    if (argc != 2)
        return -ENOENT;

    fd_t fd = open(argv[1], O_RDONLY, 0755);
    if (fd < 0)
    {
        printf("%s\n", strerror(fd));
        return fd;
    }

    while (1)
    {
        int len = read(fd, buf, 1024);
        if (len == -EEOF)
        {
            break;
        }
        write(STDOUT_FILENO, buf, len);
    }

    return 0;
}